package com.game.btnClass
{
	import flash.display.MovieClip;
	import flash.events.MouseEvent;
	
	public class McBtnClass1
	{
		private var _mc:MovieClip
		private var _fun:Function
		public function McBtnClass1(mc:MovieClip,fun:Function)
		{	_mc=mc;
			_fun=fun;
			_mc.mouseChildren=false
			_mc.buttonMode=true
			setBtnMouseEvent();
		}
		private  function setBtnMouseEvent():void{
			_mc.stop()
			_mc.addEventListener(MouseEvent.MOUSE_OVER,onBtnOver)
			_mc.addEventListener(MouseEvent.MOUSE_OUT,onBtnOut)
			_mc.addEventListener(MouseEvent.CLICK,onClick)
		}
		public  function delBtnMouseEvent():void{
			_mc.removeEventListener(MouseEvent.MOUSE_OVER,onBtnOut)
			_mc.removeEventListener(MouseEvent.MOUSE_OUT,onBtnOut)
			_mc.removeEventListener(MouseEvent.CLICK,onClick)
		}
		private function onClick(e:MouseEvent):void{
			_fun()
		}
		protected function onBtnOver(E:MouseEvent):void{
			E.target.gotoAndStop(2)
		}
		protected function onBtnOut(E:MouseEvent):void{
			
			E.target.gotoAndStop(1)
			
		}
	}
}